package com.workspace.js_website.controller;

import com.workspace.js_website.bean.RespBean;
import com.workspace.js_website.bean.MetaBean;
import com.workspace.js_website.bean.User;
import com.workspace.js_website.mapper.UserMapper;
import com.workspace.js_website.mapper.RolesMapper;
import com.workspace.js_website.service.LogService;
import com.workspace.js_website.service.SearchService;
import com.workspace.js_website.util.Util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.security.Principal;
import java.util.Arrays;

@CrossOrigin
@RestController
public class Debug {

    private final UserMapper userMapper;
    private final RolesMapper rolesMapper;
    private final SearchService searchService;
    private final LogService logService;

    @Autowired
    public Debug(UserMapper userMapper, RolesMapper rolesMapper, SearchService searchService, LogService logService) {
        this.userMapper = userMapper;
        this.rolesMapper = rolesMapper;
        this.searchService = searchService;
        this.logService = logService;
    }

    @GetMapping("/hello")
    public String hello(Principal principal) {
        return principal.getName();
    }

    @GetMapping("/debug")
    public void debug(HttpServletRequest request) {
        String a = null;
        assert a != null;
        System.out.println(a);
    }
}
